<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['middleware'=>'web'], function(){
	Route::get('/', function (Illuminate\Http\Request $request) {
        return view('welcome');
	});
    
    //不需要登录的后台模块
	Route::group(['namespace'=>'Admin', 'prefix'=>'admin'], function(){
        //登录
		Route::get('login', 'LoginController@index');
		Route::post('login/login', 'LoginController@login');
        //退出登录
        Route::get('logout', 'LoginController@logout')->name('logout');
	});	
    
    //必须登录才能使用
	Route::group(['namespace'=>'Admin', 'prefix'=>'admin',  'middleware'=>['admin.login', 'admin.info', 'admin.auth']], function(){
            
            //管理员
            Route::resource('admin', 'AdminController');
            Route::post('admin/deleteAll', 'AdminController@deleteAll')->name('admin.deleteAll');
            
            //权限
            Route::resource('auth', 'AuthController');
            Route::post('autl/deleteAll', 'AuthController@deleteAll')->name('auth.deleteAll');
            //角色
            Route::resource('role', 'RoleController');
            Route::post('role/deleteAll', 'RoleController@deleteAll')->name('role.deleteAll');
            
            //后台首页
            Route::get('default', 'IndexController@index')->name('admin.default');
        });		
});